home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / liboctave / dRowVector.h < prev    next >
C/C++ Source or Header  |  1997-03-07  |  3KB  |  118 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_RowVector_h)
  24. #define octave_RowVector_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. #include "MArray.h"
  31.  
  32. #include "mx-defs.h"
  33.  
  34. class RowVector : public MArray<double>
  35. {
  36. friend class ColumnVector;
  37.  
  38. public:
  39.  
  40.   RowVector (void) : MArray<double> () { }
  41.   RowVector (int n) : MArray<double> (n) { }
  42.   RowVector (int n, double val) : MArray<double> (n, val) { }
  43.   RowVector (const MArray<double>& a) : MArray<double> (a) { }
  44.   RowVector (const RowVector& a) : MArray<double> (a) { }
  45.  
  46.   RowVector& operator = (const RowVector& a)
  47.     {
  48.       MArray<double>::operator = (a);
  49.       return *this;
  50.     }
  51.  
  52.   bool operator == (const RowVector& a) const;
  53.   bool operator != (const RowVector& a) const;
  54.  
  55.   // destructive insert/delete/reorder operations
  56.  
  57.   RowVector& insert (const RowVector& a, int c);
  58.  
  59.   RowVector& fill (double val);
  60.   RowVector& fill (double val, int c1, int c2);
  61.  
  62.   RowVector append (const RowVector& a) const;
  63.  
  64.   ColumnVector transpose (void) const;
  65.  
  66.   friend RowVector real (const ComplexRowVector& a);
  67.   friend RowVector imag (const ComplexRowVector& a);
  68.  
  69.   // resize is the destructive equivalent for this one
  70.  
  71.   RowVector extract (int c1, int c2) const;
  72.  
  73.   // row vector by row vector -> row vector operations
  74.  
  75.   RowVector& operator += (const RowVector& a);
  76.   RowVector& operator -= (const RowVector& a);
  77.  
  78.   // row vector by matrix -> row vector
  79.  
  80.   friend RowVector operator * (const RowVector& a, const Matrix& b);
  81.  
  82.   // other operations
  83.  
  84.   RowVector map (d_d_Mapper f) const;
  85.  
  86.   RowVector& apply (d_d_Mapper f);
  87.  
  88.   double min (void) const;
  89.   double max (void) const;
  90.  
  91.   // i/o
  92.  
  93.   friend ostream& operator << (ostream& os, const RowVector& a);
  94.   friend istream& operator >> (istream& is, RowVector& a);
  95.  
  96. private:
  97.  
  98.   RowVector (double *d, int l) : MArray<double> (d, l) { }
  99. };
  100.  
  101. // row vector by column vector -> scalar
  102.  
  103. double operator * (const RowVector& a, const ColumnVector& b);
  104.  
  105. Complex operator * (const RowVector& a, const ComplexColumnVector& b);
  106.  
  107. // other operations
  108.  
  109. RowVector linspace (double x1, double x2, int n);
  110.  
  111. #endif
  112.  
  113. /*
  114. ;;; Local Variables: ***
  115. ;;; mode: C++ ***
  116. ;;; End: ***
  117. */
  118.